package AttachmentService

import (
	"context"
	toolsDb "gdshop-back-end-go/common/db"
	"gdshop-back-end-go/common/entity"
)

func GetModelByMd5(ctx context.Context, fileMd5 string) (*entity.Attachment, error) {
	var aModel *entity.Attachment
	err := toolsDb.GetUnSafaTableAddDeleteWhere(ctx, "attachment").Where("md5", fileMd5).Scan(&aModel)
	if err != nil {
		return nil, err
	}

	return aModel, nil
}
